const getQueryByName = (name) => {
  const queryNameRegex = new RegExp(`[?&]${name}=([^&]*)(&|$)`);
  const queryNameMatch = 'http://10.16.8.194/application?version=v2105&abin=good'.match(queryNameRegex);
  // const queryNameMatch = window.location.search.match(queryNameRegex);
  // 一般都会通过decodeURIComponent解码处理
  return queryNameMatch ? decodeURIComponent(queryNameMatch[1]) : "";
};

// https://www.baidu.com/?name=%E5%89%8D%E7%AB%AF%E8%83%96%E5%A4%B4%E9%B1%BC&sex=boy

// console.log(getQueryByName("name"), getQueryByName("sex")); // 前端胖头鱼 boy
console.log(getQueryByName("version")); // 前端胖头鱼 boy
const getQueryByName1 = () => {
  const queryNameRegex = /[?&]([^&]*)=([^&]*)(&|$)/g
  const queryNameMatch = 'http://10.16.8.194/application?version=v2105&abin=good'
  let res = queryNameRegex.exec(queryNameMatch)
  console.log(res);
};
getQueryByName1()